import 'package:flutter/material.dart';
import 'package:fzcgx_app/common/adapter_utils.dart';
import 'package:fzcgx_app/common/assets_utils.dart';
import 'package:fzcgx_app/provider/provider_widget.dart';
import 'package:fzcgx_app/ui/base/base_view_model.dart';
import 'package:fzcgx_app/ui/my/worker/view_model/worker_base_info_view_model.dart';
import 'package:fzcgx_app/ui/widget/custom_appbar_widget.dart';

class WorkerEvaluatePage extends StatefulWidget {
  WorkerEvaluatePage({Key key}) : super(key: key);

  @override
  _WorkerEvaluatePageState createState() => _WorkerEvaluatePageState();
}

class _WorkerEvaluatePageState extends State<WorkerEvaluatePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: CustomAppbar(
        title: '自我评价',
      ),
      body: SafeArea(
          child: ProviderWidget<WorkerBaseInfoViewModel>(
        model: WorkerBaseInfoViewModel(),
        onReady: (viewModel) {
          viewModel.requestApi();
        },
        builder: (context, viewModel, child) {
          return SingleChildScrollView(
            child: viewModel.state == ViewState.Success
                ? _buildSuccessWidget(viewModel)
                : Container(),
          );
        },
      )),
    );
  }

  Widget _buildSuccessWidget(WorkerBaseInfoViewModel viewModel) {
    return Container(
      child: Column(
        children: <Widget>[
          SizedBox(
            height: AdapterUtils.getHeight(4),
          ),
          Container(
            height: AdapterUtils.getHeight(38),
            color: Color(0xffEAF7FE),
            child: Center(
              child: Text(
                '注册填写/上传的信息越全面，客户信任度越高',
                style: TextStyle(
                  fontSize: AdapterUtils.getSp(13),
                  color: Color(0xff15A1FF),
                  fontWeight: FontWeight.w500,
                ),
              ),
            ),
          ),
          SizedBox(
            height: AdapterUtils.getHeight(28),
          ),
          Container(
            margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
            decoration: BoxDecoration(
                border: Border(
                    bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  '个人能力',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextField(
                  controller: viewModel.nameController,
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xff3B4859),
                    fontWeight: FontWeight.w500,
                  ),
                  decoration: InputDecoration(
                      contentPadding: EdgeInsets.only(
                          top: AdapterUtils.getHeight(10),
                          bottom: AdapterUtils.getHeight(20)),
                      hintText: '请输入您的个人能力',
                      border: InputBorder.none,
                      hintStyle: TextStyle(
                        fontSize: AdapterUtils.getSp(18),
                        color: Color(0xffD7D8DB),
                        fontWeight: FontWeight.w500,
                      )),
                )
              ],
            ),
          ),
          SizedBox(
            height: AdapterUtils.getHeight(24),
          ),
          Container(
            margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
            decoration: BoxDecoration(
                border: Border(
                    bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  '擅长技能',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextField(
                  controller: viewModel.zhuanyeController,
                  keyboardType: TextInputType.numberWithOptions(),
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xff3B4859),
                    fontWeight: FontWeight.w500,
                  ),
                  decoration: InputDecoration(
                      contentPadding: EdgeInsets.only(
                          top: AdapterUtils.getHeight(10),
                          bottom: AdapterUtils.getHeight(20)),
                      hintText: '请输入您的擅长技能',
                      border: InputBorder.none,
                      hintStyle: TextStyle(
                        fontSize: AdapterUtils.getSp(18),
                        color: Color(0xffD7D8DB),
                        fontWeight: FontWeight.w500,
                      )),
                )
              ],
            ),
          ),
          SizedBox(
            height: AdapterUtils.getHeight(24),
          ),
          Container(
            margin: EdgeInsets.symmetric(horizontal: AdapterUtils.getWidth(15)),
            decoration: BoxDecoration(
                border: Border(
                    bottom: BorderSide(color: Color(0xffE8E9ED), width: 1))),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  '爱好特长',
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(14),
                    color: Color(0xff606B79),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextField(
                   controller: viewModel.jiguanController,
                  keyboardType: TextInputType.numberWithOptions(),
                  style: TextStyle(
                    fontSize: AdapterUtils.getSp(18),
                    color: Color(0xff3B4859),
                    fontWeight: FontWeight.w500,
                  ),
                  decoration: InputDecoration(
                      contentPadding: EdgeInsets.only(
                          top: AdapterUtils.getHeight(10),
                          bottom: AdapterUtils.getHeight(20)),
                      hintText: '请输入您的爱好特长',
                      border: InputBorder.none,
                      hintStyle: TextStyle(
                        fontSize: AdapterUtils.getSp(18),
                        color: Color(0xffD7D8DB),
                        fontWeight: FontWeight.w500,
                      )),
                )
              ],
            ),
          ),
           SizedBox(
            height: AdapterUtils.getHeight(24),
          ),
           Container(
                width: AdapterUtils.screenWidth(),
                height: AdapterUtils.getHeight(50),
                 margin: EdgeInsets.all(15),
                child: FlatButton(
                    onPressed:  () {
                    //  viewModel.onPostApi(context);
                    },
                    disabledColor: Color(0xff15A1FF).withAlpha(80),
                    color: Color(0xff15A1FF),
                    shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.all(Radius.circular(4)),
                    ),
                    child: Text(
                      '保存',
                      style: TextStyle(
                        fontSize: AdapterUtils.getSp(16),
                        color: Colors.white,
                        fontWeight: FontWeight.w500,
                      ),
                    ))),
            SizedBox(
              height: AdapterUtils.getHeight(16),
            ),
        ],
      ),
    );
  }
}
